package com.xinqi.modules.chat.chat.group.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xinqi.common.base.enums.YesNoNumberEnum;
import com.xinqi.common.mybatis.data.entity.BaseEntity;
import com.xinqi.modules.chat.enums.group.GroupUserCommonEnum;
import com.xinqi.modules.chat.enums.group.GroupUserLeaderFlagEnum;
import com.xinqi.modules.chat.enums.group.GroupUserStatusEnum;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

/**
 * 群组成员表实体层
 *
 * @author: system
 * @date: 2023/01/12
 */
@Setter
@Getter
@TableName("ca_chat_group_user")
public class ChatGroupUserEntity extends BaseEntity {
    /**
     * 融云返回群聊ID
     */
    @TableField(value = "group_id")
    private String groupId;
    /**
     * 用户ID
     */
    @TableField(value = "user_id")
    private Long userId;
    /**
     * 用户标识 1群主 2管理员 3普通用户
     */
    @TableField(value = "leader_flag")
    private Integer leaderFlag;
    /**
     * 群组备注名称
     */
    @TableField(value = "group_rename")
    private String groupRename;
    /**
     * 我在群中昵称
     */
    @TableField(value = "renames")
    private String renames;
    /**
     * 设置群聊天背景
     */
    @TableField(value = "background")
    private String background;
    /**
     * 设置群置顶
     */
    @TableField(value = "is_top")
    private Integer isTop;
    /**
     * 置顶时间
     */
    @TableField(value = "top_time")
    private LocalDateTime topTime;
    /**
     * 设置隐藏回话(有新消息自动打开)
     */
    @TableField(value = "hidden_chat")
    private Integer hiddenChat;
    /**
     * 设置是否显示群成员昵称
     */
    @TableField(value = "show_member_name")
    private Integer showMemberName;
    /**
     * 设置免打扰
     */
    @TableField(value = "is_disturb")
    private Integer isDisturb;
    /**
     * 关注的人员
     */
    @TableField(value = "follow")
    private String follow;
    /**
     * 在群中的状态 0待审核 1正常
     */
    @TableField(value = "status")
    private Integer status;
    /**
     * 加群方式
     */
    @TableField(value = "common")
    private String common;

    public ChatGroupUserEntity() {

    }


    public ChatGroupUserEntity(String groupId, Long userId, String groupRename, String renames, String background, String follow) {
        this.groupId = groupId;
        this.userId = userId;
        this.leaderFlag = GroupUserLeaderFlagEnum.THREE.getCode();
        this.groupRename = groupRename;
        this.renames = renames;
        this.background = background;
        this.isTop = YesNoNumberEnum.NO.getCode();
        this.hiddenChat = YesNoNumberEnum.NO.getCode();
        this.showMemberName = YesNoNumberEnum.YES.getCode();
        this.isDisturb = YesNoNumberEnum.NO.getCode();
        this.follow = follow;
        this.status = GroupUserStatusEnum.ZERO.getCode();
        this.common = GroupUserCommonEnum.UNKNOWN.getCode();
    }
}
